<template>
  <div>
    <el-form :inline="true" class="demo-form-inline" style="margin-top: 20px">

      <el-table
              v-loading="loading"
              :data="pageInfo.list"
              style="width: 100%"
              :stripe=true
              height="450">
        <el-table-column
                label="公司图标"
                prop="companyImg"
                width="120">
          <template width="90" slot-scope="scope">
            <img :src="$config.url+scope.row.company.companyImg" style="height: 60px;width: 60px">
          </template>
        </el-table-column>
        <el-table-column
                label="公司名称"
                width="350">
          <template width="90" slot-scope="scope">
            <span >{{scope.row.company.companyName}}</span>
          </template>
        </el-table-column>
        <el-table-column
                label="领域"
                width="120">
          <template width="90" slot-scope="scope">
            <span >{{scope.row.company.business}}</span>
          </template>
        </el-table-column>
        <el-table-column
                label="地址"
                width="220">
          <template width="90" slot-scope="scope">
            <span >{{scope.row.company.address}}</span>
          </template>
        </el-table-column>
      </el-table>
    </el-form>
    <div style="float: right">
      <el-pagination
              background
              layout="prev, pager, next"
              :total="pageInfo.total"
              :page-size="pageInfo.pageSize"
              @current-change="handlePage"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
  import {makeSimpleDate,makeDate} from "../../common/js/dateformat"
  export default {
    name: "job-fair-company",
    props:{//父组件传一个jobfairId过来
      jobfairId: Number,
    },
    data(){
      return {
        loading: false,
        pageIndex:1,
        pageInfo:{}
      }
    },
    created(){
      this.getCompanyList();
    },
    methods:{
      getCompanyList(){
        this.loading=true;
        this.$ajax.post(this.$config.url + `jobfaircompany/selJobfaircompany/${this.pageIndex}`,{
          "jobfairId":this.jobfairId
            }
        ).then(res => {
          this.pageInfo = res.data;
          this.loading = false;
        }).finally(() => {
        })
      },
      makeSimpleDate(date) {
        return makeSimpleDate(date)
      },
      makeDate(date){
        return makeDate(date)
      },
      handlePage(val) {
        //console.log(val)
        this.pageIndex = val
        //加载数据
        this.getCompanyList()
      },

    }
  }
</script>

<style scoped>

</style>